/*
 * Spreed WebRTC.
 * Copyright (C) 2013-2015 struktur AG
 *
 * This file is part of Spreed WebRTC.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

.mainScreenshare,
.mainPresentation {
  // scss-lint:disable IdSelector
  #audiovideo {
    @include breakpt($breakpoint-video-medium, max-width, only screen) {
      display: none;
    }
  }
}

.withChat {
  // scss-lint:disable IdSelector
  #audiovideo {
    right: $chat-width;
  }
}

.withBuddylist {
  // scss-lint:disable IdSelector
  #audiovideo {
    right: $buddylist-width;
  }
}

.withBuddylist.withChat #audiovideo { // scss-lint:disable IdSelector
  right: $chat-width + $buddylist-width;
}

#audiovideo { // scss-lint:disable IdSelector
  bottom: 0;
  left: 0;
  position: absolute;
  right: 0;
  top: $minbarheight;
  user-select: none;

  @include breakpt($breakpoint-video-small, max-width, only screen) {
    right: 0 !important;
  }

  &.fullscreen {
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;

    .remoteVideo .peerActions {
      display: none;
    }
  }
}

.audiovideo {
  bottom: 0;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;

  &.active {
    perspective: 1000;

    &:hover .overlayActions {
      opacity: .3;
    }

    .overlayActions:hover {
      opacity: .6;
    }

    .audiovideoBase {
      transform: rotateY(180deg);
    }
  }

  .audiovideoBase {
    height: 100%;
    position: relative;
    transform: rotateY(0deg);
    transition-duration: 2s;
    transition-property: transform;
    width: 100%;
    z-index: 2;
  }

  .localContainer {
    bottom: 0;
    left: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    transform: scale(-1, 1);
    z-index: 2;
    overflow: hidden;
  }

  video {
    object-fit: cover;
  }

  .onlyaudio {
    bottom: 0;
    color: $video-onlyaudio;
    display: none;
    font-size: 1em;
    left: 0;
    pointer-events: auto;
    position: absolute;
    right: 0;
    text-align: center;
    top: 0;

    &:before {
      content: '';
      display: inline-block;
      height: 100%;
      vertical-align: middle;
    }

    > * {
      font-size: 6em;
      vertical-align: middle;
    }
  }


  .remoteContainer {
    bottom: 0;
    left: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    transform: rotateY(180deg);
    z-index: 2;
  }

  .miniContainer {
    background: #000;
    bottom: 2px;
    height: 100%;
    max-height: 18%;
    opacity: 0;
    position: absolute;
    right: 2px;
    transform: scale(-1, 1);
    transition-duration: .5s;
    transition-property: opacity;
    z-index: 25;
    overflow: hidden;

    &.visible {
      opacity: 1;
    }
  }

  &.cameraMute .miniContainer,
  &.cameraMute .localVideos {
    background: $video-onlyaudio-background;

    .onlyaudio {
      display: block;
    }

    video {
      visibility: hidden;
    }
  }

  .miniVideo {
    display: block;
    height: 100%;
    max-height: 100%;
    max-width: 100%;
    width: 100%;
  }

  .localVideo {
    background: $video-background;
    display: block;
    max-height: 100%;
    opacity: 0;
    transition-duration: 2s;
    transition-property: opacity;
    width: 100%;
  }

  .localVideos {
    bottom: 0;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition-duration: 2s;
    transition-property: opacity;
  }

  .remoteVideos {
    bottom: 0;
    left: 0;
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition-duration: 2s;
    transition-property: opacity;

    video {
      display: block;
      height: 100%;
      width: 100%;
    }
  }

  .overlayActions {
    background: $video-overlayactions;
    bottom: 0;
    height: 140px;
    left: 0;
    margin: auto 0;
    opacity: 0;
    padding: 3px 0;
    position: absolute;
    top: 0;
    width: 40px;
    z-index: 5;

    .btn {
      color: #ccc;
      cursor: pointer;
      display: block;
      outline: 0;
      text-shadow: 0 0 5px #000;
      width: 40px;
    }
  }

  .remoteVideo {
    background: $video-background;
    display: inline-block;
    max-height: 100%;
    max-width: 100%;
    overflow: hidden;
    position: relative;
    vertical-align: bottom;
    //visibility: hidden;
    width: 100%;

    &.withvideo {
      //visibility: visible;
    }

    &.onlyaudioVideo {
      background: $video-onlyaudio-background;
      //visibility: visible;

      .onlyaudio {
        display: block;
      }
    }

    &.onlyaudioVideo video,
    &.dummy video {
      visibility: hidden;
    }

    &.dummy .onlyaudio {
      display: block;
    }

    .peerActions {
      // scss:lint:disable NestingDepth, SelectorDepth
      bottom: 5%;
      left: 40px;
      opacity: 0;
      pointer-events: auto;
      position: absolute;
      right: 40px;
      text-align: center;
      transition-duration: .2s;
      transition-property: opacity;
      z-index: 10;

      &:hover {
        opacity: .5;
      }

      i {
        font-size: 3vw;
      }
    }

    .peerLabel {
      bottom: 4%;
      color: #fff;
      font-size: 2.5vw;
      left: 4%;
      max-width: 30%;
      opacity: .7;
      overflow: hidden;
      padding: 4px;
      position: absolute;
      text-overflow: ellipsis;
      text-shadow: 0 0 4px #000;
      white-space: nowrap;
      z-index: 8;
    }
  }
}

.remoteVideo {
  &.talking .peerLabel {
    color: $audiovideolevel;
  }

  .peerLabel {
    transition: color 500ms ease-out;
  }

  .overlayLogo {
    background: url('../img/logo-overlay.png') no-repeat center;
    background-size: 100%;
    height: 20%;
    max-height: 40px;
    max-width: 111px;
    opacity: .5;
    pointer-events: none;
    position: absolute;
    right: 2.5%;
    top: 4%;
    width: 20%;
    z-index: 2;
  }
}

.miniContainer {
  &.talking:after {
    bottom: 2px;
    box-shadow: 0 0 20px $audiovideolevel inset;
    content: '';
    left: 2px;
    position: absolute;
    right: 2px;
    top: 2px;
  }

  video {
  }
}

.renderer-smally {
  // scss-lint:disable SelectorDepth
  background: #000;
  border-right: 0;
  border-top: 0;
  width: 150px;

  .remoteVideos {
    padding-bottom: 85px;
  }

  .remoteVideo {
    .peerLabel {
      font-size: .9em;
      font-weight: bold;
    }

    .peerActions i {
      font-size: 1em;
    }
  }

  .miniContainer {
    bottom: 0;
    height: 85px;
    left: 0;
    max-height: none;
    right: 0;
  }
}

.renderer-onepeople {
  .miniContainer .onlyaudio {
    font-size: .4em;
  }
}

.renderer-democrazy {
  .remoteVideos .miniContainer {
    bottom: auto;
    display: inline-block;
    max-height: 100%;
    max-width: 100%;
    position: relative;
    right: auto;
    vertical-align: bottom;
  }

  .active .miniContainer {
    opacity: 1;
  }
}

.renderer-conferencekiosk {
  // scss-lint:disable SelectorDepth
  .remoteVideos {
    background: $video-background;
    bottom: 2px;
    min-height: 108px;
    pointer-events: auto;
    text-align: center;
    top: auto;
    white-space: nowrap;

    > div {
      cursor: pointer;
      height: 108px;
      width: 192px;
    }

    .overlayLogo {
      display: none;
    }

    .peerLabel,
    .peerActions i {
      font-size: 1.1em;
    }

    .peerLabel {
      background: $video-overlayactions;
    }
  }

  .miniContainer {
    height: 108px;
    max-height: none;
    width: 192px;
  }

  .bigVideo {
    bottom: 112px;
    left: 0;
    margin: auto;
    opacity: 0;
    position: absolute;
    right: 0;
    top: 2px;
    transition-duration: 2s;
    transition-property: opacity;

    video {
      height: 100%;
      width: 100%;
    }
  }
}

.renderer-auditorium {
  position: relative;

  span:before {
    content: '\f183';
    left: 50%;
    margin-left: -.8em;
    margin-top: -.5em;
    position: absolute;
    top: 50%;
  }

  span:after {
    content: '\f183';
    margin-right: -.9em;
    margin-top: -.5em;
    position: absolute;
    right: 50%;
    top: 50%;
  }

  .remoteContainer {
    border-left: 40px solid #000;
  }

  .remoteVideos {
    background: $video-background;
    pointer-events: auto;
    top: 180px;
    width: 320px;

    video {
      height: 100%;
      margin-top: -9px;
      object-fit: cover;
      width: 100%;
    }

    > div {
      cursor: pointer;
      display: inline-block;
      height: 60px;
      width: 80px;
    }

    .overlayLogo {
      display: none;
    }

    .peerLabel {
      background: $video-overlayactions;
      bottom: 0;
      font-size: .6em;
      left: 0;
      line-height: 9px;
      max-width: 100%;
      padding: 0 4px;
      right: 0;
    }

    .peerActions {
      display: none;
    }

    .miniContainer {
      max-height: auto;
      right: auto;
    }
  }

  .bigVideo {
    height: 180px;
    width: 320px;

    .remoteVideo,
    .video {
      height: 100%;
      width: 100%;
    }

    .peerLabel {
      bottom: 8%;
      font-size: 1vw;
      max-width: 40%;
    }
  }
}

